Telegram Group & Telegram Channel
🚀 Как ускорить Python-код для ресурсоёмких задач

При работе с большими объёмами данных Python может «тормозить», особенно при обработке сотен тысяч строк или обучении сложных ML-моделей.

🎯 Ниже — два приёма, которые позволят ускорить обучение и загрузку данных в десятки раз.

1️⃣ Используйте GPU с включённым memory growth

По умолчанию TensorFlow может попытаться занять всю память видеокарты, что приводит к ошибке OOM. Решение — включить «постепенное» выделение памяти:
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)


2️⃣ Оптимизируйте загрузку данных с `tf.data`

Загрузка Excel-файла — типичное узкое место (Disk I/O). Использование tf.data.Dataset с prefetch позволяет загружать и обрабатывать данные асинхронно.

Пример:
dataset = tf.data.Dataset.from_generator(
data_generator,
output_signature={col: tf.TensorSpec(shape=(), dtype=tf.float32) for col in data.columns}
).shuffle(1000).batch(32).prefetch(tf.data.AUTOTUNE)


📎 Вывод:
GPU и tf.data с правильной настройкой дают мощный прирост производительности. Особенно важно при работе с крупными ML-пайплайнами и в продакшене.

Библиотека дата-сайентиста #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/dsproglib/6445
Create:
Last Update:

🚀 Как ускорить Python-код для ресурсоёмких задач

При работе с большими объёмами данных Python может «тормозить», особенно при обработке сотен тысяч строк или обучении сложных ML-моделей.

🎯 Ниже — два приёма, которые позволят ускорить обучение и загрузку данных в десятки раз.

1️⃣ Используйте GPU с включённым memory growth

По умолчанию TensorFlow может попытаться занять всю память видеокарты, что приводит к ошибке OOM. Решение — включить «постепенное» выделение памяти:

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)


2️⃣ Оптимизируйте загрузку данных с `tf.data`

Загрузка Excel-файла — типичное узкое место (Disk I/O). Использование tf.data.Dataset с prefetch позволяет загружать и обрабатывать данные асинхронно.

Пример:
dataset = tf.data.Dataset.from_generator(
data_generator,
output_signature={col: tf.TensorSpec(shape=(), dtype=tf.float32) for col in data.columns}
).shuffle(1000).batch(32).prefetch(tf.data.AUTOTUNE)


📎 Вывод:
GPU и tf.data с правильной настройкой дают мощный прирост производительности. Особенно важно при работе с крупными ML-пайплайнами и в продакшене.

Библиотека дата-сайентиста #буст

BY Библиотека дата-сайентиста | Data Science, Machine learning, анализ данных, машинное обучение




Share with your friend now:
tg-me.com/dsproglib/6445

View MORE
Open in Telegram


Библиотека дата сайентиста | Data Science Machine learning анализ данных машинное обучение Telegram | DID YOU KNOW?

Date: |

What Is Bitcoin?

Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.Библиотека дата сайентиста | Data Science Machine learning анализ данных машинное обучение from ua


Telegram Библиотека дата-сайентиста | Data Science, Machine learning, анализ данных, машинное обучение
FROM USA